<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('修改收据管理')" />
    <th:block th:include="include :: datetimepicker-css" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-receipts-edit" th:object="${tbReceipts}">
            <input name="id" th:field="*{id}" type="hidden">
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">交款单位(或姓名)：</label>
                <div class="col-sm-8">
                    <input name="companyName" th:field="*{companyName}" class="form-control" type="text" required>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">收据日期：</label>
                <div class="col-sm-8">
                    <div class="input-group date">
                        <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                        <input name="receiptDate" th:value="${#dates.format(tbReceipts.receiptDate, 'yyyy-MM-dd')}" class="form-control" placeholder="yyyy-MM-dd" type="text" readonly required>
                    </div>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">收据号：</label>
                <div class="col-sm-8">
                    <input name="receiptNo" th:field="*{receiptNo}" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">收款方式：</label>
                <div class="col-sm-8">
                    <select name="receiptMode" class="form-control m-b" th:with="type=${@dict.getType('receipt_type')}" required>
                        <option value="">请选择</option>
                        <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{receiptMode}"></option>
                    </select>
                    <span class="help-block m-b-none"><i class="fa fa-info-circle"></i> 请选择字典属性</span>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">人民币：</label>
                <div class="col-sm-8">
                    <input name="receiptRmb" th:field="*{receiptRmb}" class="form-control" type="text" onblur="showRmbUpperCase(this);" required>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">人民币大写：</label>
                <div class="col-sm-8">
                    <input name="receiptRmbUpp" th:field="*{receiptRmbUpp}" class="form-control" type="text" readonly>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">备注事项：</label>
                <div class="col-sm-8">
                    <select name="remarkType" class="form-control m-b" th:with="type=${@dict.getType('receipt_remark_type')}">
                        <option value="">请选择</option>
                        <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{remarkType}"></option>
                    </select>
                    <span class="help-block m-b-none"><i class="fa fa-info-circle"></i> 请选择字典属性</span>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">备注：</label>
                <div class="col-sm-8">
                    <input name="remark" th:field="*{remark}" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">出纳：</label>
                <div class="col-sm-8">
                    <input name="cashier" th:field="*{cashier}" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">经办人：</label>
                <div class="col-sm-8">
                    <input name="operator" th:field="*{operator}" class="form-control" type="hidden" readonly>
                    <input name="operatorName" th:field="${operateUser.userName}" class="form-control" type="text" readonly>
                </div>
            </div>
        </form>
    </div>
    <th:block th:include="include :: footer" />
    <th:block th:include="include :: datetimepicker-js" />
    <script type="text/javascript">
        var prefix = ctx + "system/receipts";
        $("#form-receipts-edit").validate({
            focusCleanup: true
        });

        function submitHandler() {
            if ($.validate.form()) {
                var _form = $('#form-receipts-edit').serialize();
                $.operate.save(prefix + "/edit", _form);
            }
        }

        $("input[name='receiptDate']").datetimepicker({
            format: "yyyy-mm-dd",
            minView: "month",
            autoclose: true
        });

        function showRmbUpperCase(obj){
            var _rmb = obj.value;
            if(!isNaN(_rmb)){
                _rmb = convertCurrency(_rmb);
                $("input[name='receiptRmbUpp']").val(_rmb);
            }
        }
    </script>
</body>
</html>